<template>
  <div>
    <slider :announcement="announcement" :slides="sliders"></slider>
    <booklist :books="lastupdatebooks"
              heading="最近更新"
              @haha="xxx"></booklist>

    <booklist :books="recommendeds"
              heading="编辑推荐"
              @haha="xxx"></booklist>

  </div>
</template>
<!-- home -->
<script type="text/ecmascript-6">
    import slider from './slider.vue'
    import booklist from "./list.vue"

    export default{
        components: {slider, booklist}//{slider, booklist}
        ,created(){
            this.$http.get("/src/data.json").then(
                res=>{
                    console.log(res);
                    this.lastupdatebooks=res.body.lastupdatebooks;
                    this.recommendeds=res.body.recommended;
                    this.announcement=res.body.announcement;
                    this.sliders=res.body.slides;
                }
            )
        }
        ,data(){
            return {
                lastupdatebooks:[],
                recommendeds:[]
                , announcement:'',
                sliders: []
            }
        }
        ,methods:{
            xxx(){
                window.alert('hahahhaha');
            }
        }
    }
</script>